package ru.hh.school;

import java.util.*;

public class RoomManager {
    private Map<String, Room> rooms = new HashMap<String, Room>();

    public RoomManager(Set<String> names) {
        if (!names.contains("default")) {
            names.add("default");
        }
        for (String name : names) {
            rooms.put(name, new Room(name));
        }
    }

    public Room getRoom(String name) {
        return rooms.get(name);
    }

    public Room getDefaultRoom() {
        return rooms.get("default");
    }

    public List<String> getRoomNames() {
        ArrayList<String> result = new ArrayList<String>();
        for (Room room : rooms.values()) {
            result.add(room.getName());
        }
        return result;
    }
}
